<%@page import="com.windfone.common.Constant"%>
<%@ page language="java" contentType="text/html; charset=utf-8"    pageEncoding="utf-8"%>
<%@include file="header.jsp"%>
<style type="text/css">
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
.STYLE1 {
	color: #666666;
	font-weight: bold;
}
.STYLE5 {color: #666666}
.STYLE6 {
	color: #135294;
	font-weight: bold;
}
</style>
<script>
function checkAndSubmit(){
	var form = document.getElementById("addPackageComposeForm");
	var price = $("#packageComposePriceStr").val();
	 
	if ( isdigit( price )){
		form.submit();
	} else {
		alert("价格只能输入数字!");
		$("#packageComposePriceStr").focus();
		return false;  
	}
}
function setValue(id,compose,price,description){
	$("#compose").val(compose);
	$("#packageComposePriceStr").val(price);
	$("#description").val(description);
	$("#packageComposeId").val(id);
	$("#tijiao").val("更新");
	$("#operateType").val("update");
}
function isdigit(s){
	var patrn= /^[-\+]?\d+(\.\d+)?$/ ;
	if (!patrn.exec(s)) 
		return false  ;
	else 
		return true;
	
}
</script>
<div align="center">套餐组合列表</div>
 <table width="95%"  border="0" cellpadding="3" cellspacing="2" bgcolor="#FFFFFF" align="center">
   <tr>
     <td nowrap background="images/bg_table.jpg" bgcolor="#ECEAE6">套餐名称</td>
     <td nowrap background="images/bg_table.jpg" bgcolor="#ECEAE6">价格</td>
     <td nowrap background="images/bg_table.jpg" bgcolor="#ECEAE6">备注</td>
     <td nowrap background="images/bg_table.jpg" bgcolor="#ECEAE6">操作</td>
   </tr>
   <s:iterator value="packageComposes">
     <tr bgcolor='#F1F3F5' onmouseover = "this.style.backgroundColor = '#FFDCB0'" onmouseout = "this.style.backgroundColor = ''" style='cursor:hand'>
       <td><s:property value="compose"/></td>
       <td><s:property value="price"/></td>
       <td><s:property value="description"/></td>
       <td>
       <a href="#" onclick="setValue(<s:property value='id'/>,'<s:property value='compose'/>','<s:property value='price'/>','<s:property value='description'/>')">编辑</a> 
       <a href="deletePackageCompose.action?packageComposeId=<s:property value='id'/>&productId=<s:property value='productId'/>" onclick="javascript:if(confirm('确定删除套餐吗')) return true; else return false;">删除</a> </td>
     </tr>
   </s:iterator>
   <tr>
     <td colspan="4" nowrap  bgcolor='#E4EDF9'>
     	<form method="post" action="packageCompose.action" id="addPackageComposeForm">
     		套餐:<input type="text" name="compose" id="compose" size="50"/><br/>
     		备注:<input type="text" name="description" id="description" size="50"/><br/>
     		价格:<input type="text" name="packageComposePriceStr" id="packageComposePriceStr"/><br/>
     		<input type="hidden" name="productId"  value="<s:property value='productId'/>"/>
     		<input type="hidden" name="packageComposeId"  id="packageComposeId" value="0"/>
     		<input type="hidden" name="operateType" id="operateType"  value="Add"/>
     		<input type="hidden" name="packageTypeId" value="<%=Constant.COLOR_TYPE_PRODUCT %>"/>
     		<input type="button" name="tijiao" id="tijiao" value="新增" onclick="checkAndSubmit()"/>&nbsp;
     		<input type="reset" name="resetName"  id="resetName"/>
     		<input type="button" name="return"  value="返回" onclick="javascript:window.location.href='productList.action';"/>
     	</form>
     </td>
   </tr>
   <tr/> 
</table>
 